home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-12-12 | 1.2 KB | 59 lines |
- /*
- * Copyright(C) 1996 Sony Corporation. All rights reserved.
- */
-
- import vrml.*;
- import vrml.field.*;
- import vrml.node.*;
- import java.util.*;
- import vs.*;
-
- public class ball extends Script{
- /* Node */
- SFNode BallNode;
-
- /* EventOut */
- SFTime BallTimeSensorStartTime;
-
- public void initialize() {
- /* Node */
- BallNode = (SFNode) getField( "BallNode" );
-
- /* EventOut */
- BallTimeSensorStartTime = (SFTime) getEventOut( "BallTimeSensorStartTime" );
- }
-
- public void processEvent(Event e) {
- String name = e.getName () ;
-
- if(name.equals("BallTouchSensorIsActive")) { BallTouchSensorIsActive(e); }
- if(name.equals("BallShareTouched")){ BallShareTouched(e); }
- }
-
- public void BallTouchSensorIsActive(Event e) {
- double time = e.getTimeStamp();
- ConstSFBool mouse_down = (ConstSFBool)e.getValue();
-
- if (mouse_down.getValue()) return; /* mouseDown */
-
- BallStart( time );
- Vscp.sendApplSpecificMsgWithDist( BallNode, "BallShareTouched", "void", Vscp.allClientsExceptMe );
- }
-
- public void BallShareTouched(Event e) {
- double time = e.getTimeStamp();
-
- BallStart( time );
-
- }
-
- public void BallStart ( double time ) {
-
- BallTimeSensorStartTime.setValue( time );
-
- }
- }
-
-
-